home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / SMAK124.ARJ / SMAK_C.DOC < prev    next >
Text File  |  1992-04-09  |  2KB  |  71 lines

  1.  
  2.                        Using SMAK with C source files
  3.  
  4.  
  5. SMAK works with C, too!  The /2 command line parameter can be used
  6. to specify Microsoft C compiler format.
  7.  
  8. Note:  My knowledge of C is limited to Microsoft's Quick C 2.0, which is
  9. the only C compiler I have tested SMAK with.  I would appreciate any
  10. information that others can provide me with on other C compilers.
  11.  
  12.  
  13.  
  14. Entering "SMAK hello.c /2" command at the DOS prompt will "make" the
  15. following sample C program.  Note the QCL compiler /c switch that tells
  16. the QCL compiler not to pass the object files to the linker automatically,
  17. since SMAK will do this.
  18.  
  19.  
  20.  
  21. /* =================== Begin program HELLO.C =================== */
  22.  
  23. #include <c:\qc2\include\stdio.h>
  24.  
  25. /*  Note that SMAK directives are commented off.  */
  26.  
  27. /*
  28.  
  29. 'begin MAKE
  30. '  c:\qc2\bin\qcl             'compiler program
  31. '  c:\qc2\bin\link            'linker program and options
  32. '  begin C                    'source file default extension - source list follows
  33. '    c:\qc2\samples\hello /c  '  main source module with compile options
  34. '  begin OBJ                  'object file default extension - object list follows
  35. '  begin LIB
  36. '    c:\qc2\lib\slibce        'linker library
  37. 'end MAKE
  38.  
  39. */
  40.  
  41.  
  42. main()
  43. {
  44.   printf ("  HELLO!  (compiled and linked with SMAK, written in Quick C 2.0)");
  45. }
  46.  
  47.  
  48. /* ==================== End program HELLO.C ==================== */
  49.  
  50.  
  51. Alternately, you could rely on the QCL program to do the linking, rather
  52. than SMAK, by using the following make directives:
  53.  
  54. /*
  55.  
  56. 'begin MAKE
  57. '  c:\qc2\bin\qcl             'compiler program
  58. '                             'no linker program, QCL handles linking
  59. '  begin C                    'default source extension - source list follows
  60. '    c:\qc2\samples\hello     '  main source module with compile options
  61. 'end MAKE
  62.  
  63. */
  64.  
  65. This is not desirable, however, as all compiler options and link commands
  66. would have to be specified on a single line along with the main source
  67. module, just as you would do from the command line.  For more complex,
  68. multi-module programs, the first SMAK script is more manageable and
  69. clearer.  The organized, columnar approach that SMAK uses makes it
  70. preferable to the QCL spaghetti-code method.
  71.